<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ include file="/WEB-INF/jsp/include/head.jsp"%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<script type="text/javascript"
	src="<%=WEBPATH%>/dwr/interface/WorkflowStepAction.js?id=<%=generate%>"></script>
<title><html:text name="sys.name" /></title>
</head>
<body>
<form id="listDataForm" method="post"
	action="<%=WEBPATH%>/workflow/workflowStep/index.crm">
<table  class="condition-table">
<tr>
	<td colspan="4" class="x-panel-header" align="center"><html:text name="workflowStep" /><html:text name="entity.list" /></td>
</tr>
<tr>
	<td align="right">&nbsp;</td>
	<td  colspan="3">
	<input type="submit" value="<html:text name="button.query"/>">&nbsp;&nbsp;
	<input type="button" id="new" name="new" onclick="javascript:newFunction();" value="<html:text name="button.new"/>">&nbsp;&nbsp;
	<input type="button" id="delete" name="delete" onclick="javascript:deleteFunction();" value="<html:text name="button.delete"/>">&nbsp;&nbsp;
	<input type="button" id="edit" name="edit" onclick="javascript:editFunction();" value="<html:text name="button.modify"/>">&nbsp;&nbsp;
	<input type="button" id="view" name="view" onclick="javascript:viewFunction();" value="<html:text name="button.view"/>">
	</td>
</tr> 
</table>
<script type="text/javascript">
	function newFunction(){
		window.location="<%=WEBPATH%>/workflow/workflowStep/create.crm";
	}
	function deleteFunction(){
		if(checkSelectData()){
			var id=checkMultiSelectData();
			if(id==null||id=="0"){
				alert("<html:text name="entity.deleted.select"/>");
				return ;
			}
			if(confirm("<html:text name="entity.deleted.confirm"/>")){
				//alert(id);
				WorkflowStepAction.dwrDelete(id,callFunction);
			}
		}else{
			alert("<html:text name="entity.deleted.select"/>");
		}
		
	}
	function callFunction(data){
		if(data=="success"){
			alert("<html:text name="entity.deleted"/>");
			_$("listDataForm").submit();
		}else{ 
			alert("<html:text name="entity.deleted.error"/>");
		}
	}
	function editFunction(){
		if(checkSelectData()){
			var id=checkBooleanSelectData();
			if(id==null){
				alert("<html:text name="entity.updated.select"/>");
				return ;
			}
			window.location="<%=WEBPATH%>/workflow/workflowStep/edit.crm?id="+id;
		}else{
			alert("<html:text name="entity.updated.select"/>");
		}
	}
	function viewFunction(){
		if(checkSelectData()){
			var id=checkBooleanSelectData();
			if(id==null){
				alert("<html:text name="entity.view.select"/>");
				return ;
			}
			window.location="<%=WEBPATH%>/workflow/workflowStep/view.crm?id="+id;
		}else{
			alert("<html:text name="entity.view.select"/>");
		} 
	}
	function imgOnclick(orderBy,asc){
		jQuery("#orderBy").val(orderBy);
		jQuery("#asc").val(asc);
		_$("listDataForm").submit();
	}
</script>

<table class="datatable"> 
		<thead>
		<tr>
			<td align="left" width="80"><input type="checkbox" id="checkList" onclick="javascript:onSelectChange(this);"><html:text
				name="entity.choose" /><html:hidden
			id="asc" name="asc" /><html:hidden
			id="orderBy" name="orderBy" /></td>
					<td align="left" <html:if test="asc"> onclick="javascript:imgOnclick('stepName',false);"</html:if><html:else> onclick="javascript:imgOnclick('stepName',true);" </html:else>><html:text name="workflowStep.stepName" /><html:if test="orderBy=='stepName'">&nbsp;<img  class="sort-arrow" <html:if test="asc"> src="<%=WEBPATH%>/images/arrow_up.png"</html:if><html:else> src="<%=WEBPATH%>/images/arrow_down.png"</html:else> /> </html:if></td>
		<td align="left" <html:if test="asc"> onclick="javascript:imgOnclick('description',false);"</html:if><html:else> onclick="javascript:imgOnclick('description',true);" </html:else>><html:text name="workflowStep.description" /><html:if test="orderBy=='description'">&nbsp;<img  class="sort-arrow" <html:if test="asc"> src="<%=WEBPATH%>/images/arrow_up.png"</html:if><html:else> src="<%=WEBPATH%>/images/arrow_down.png"</html:else> /> </html:if></td>
		<td align="left" <html:if test="asc"> onclick="javascript:imgOnclick('index',false);"</html:if><html:else> onclick="javascript:imgOnclick('index',true);" </html:else>><html:text name="workflowStep.index" /><html:if test="orderBy=='index'">&nbsp;<img  class="sort-arrow" <html:if test="asc"> src="<%=WEBPATH%>/images/arrow_up.png"</html:if><html:else> src="<%=WEBPATH%>/images/arrow_down.png"</html:else> /> </html:if></td>
		<td align="left" <html:if test="asc"> onclick="javascript:imgOnclick('type',false);"</html:if><html:else> onclick="javascript:imgOnclick('type',true);" </html:else>><html:text name="workflowStep.type" /><html:if test="orderBy=='type'">&nbsp;<img  class="sort-arrow" <html:if test="asc"> src="<%=WEBPATH%>/images/arrow_up.png"</html:if><html:else> src="<%=WEBPATH%>/images/arrow_down.png"</html:else> /> </html:if></td>
		<td align="left" <html:if test="asc"> onclick="javascript:imgOnclick('initFunction',false);"</html:if><html:else> onclick="javascript:imgOnclick('initFunction',true);" </html:else>><html:text name="workflowStep.initFunction" /><html:if test="orderBy=='initFunction'">&nbsp;<img  class="sort-arrow" <html:if test="asc"> src="<%=WEBPATH%>/images/arrow_up.png"</html:if><html:else> src="<%=WEBPATH%>/images/arrow_down.png"</html:else> /> </html:if></td>
		<td align="left" <html:if test="asc"> onclick="javascript:imgOnclick('runFunction',false);"</html:if><html:else> onclick="javascript:imgOnclick('runFunction',true);" </html:else>><html:text name="workflowStep.runFunction" /><html:if test="orderBy=='runFunction'">&nbsp;<img  class="sort-arrow" <html:if test="asc"> src="<%=WEBPATH%>/images/arrow_up.png"</html:if><html:else> src="<%=WEBPATH%>/images/arrow_down.png"</html:else> /> </html:if></td>
		<td align="left" <html:if test="asc"> onclick="javascript:imgOnclick('saveFunction',false);"</html:if><html:else> onclick="javascript:imgOnclick('saveFunction',true);" </html:else>><html:text name="workflowStep.saveFunction" /><html:if test="orderBy=='saveFunction'">&nbsp;<img  class="sort-arrow" <html:if test="asc"> src="<%=WEBPATH%>/images/arrow_up.png"</html:if><html:else> src="<%=WEBPATH%>/images/arrow_down.png"</html:else> /> </html:if></td>
		<td align="left" <html:if test="asc"> onclick="javascript:imgOnclick('transitFunction',false);"</html:if><html:else> onclick="javascript:imgOnclick('transitFunction',true);" </html:else>><html:text name="workflowStep.transitFunction" /><html:if test="orderBy=='transitFunction'">&nbsp;<img  class="sort-arrow" <html:if test="asc"> src="<%=WEBPATH%>/images/arrow_up.png"</html:if><html:else> src="<%=WEBPATH%>/images/arrow_down.png"</html:else> /> </html:if></td>
		<td align="left" <html:if test="asc"> onclick="javascript:imgOnclick('isCanEnd',false);"</html:if><html:else> onclick="javascript:imgOnclick('isCanEnd',true);" </html:else>><html:text name="workflowStep.isCanEnd" /><html:if test="orderBy=='isCanEnd'">&nbsp;<img  class="sort-arrow" <html:if test="asc"> src="<%=WEBPATH%>/images/arrow_up.png"</html:if><html:else> src="<%=WEBPATH%>/images/arrow_down.png"</html:else> /> </html:if></td>
		<td align="left" <html:if test="asc"> onclick="javascript:imgOnclick('executor',false);"</html:if><html:else> onclick="javascript:imgOnclick('executor',true);" </html:else>><html:text name="workflowStep.executor" /><html:if test="orderBy=='executor'">&nbsp;<img  class="sort-arrow" <html:if test="asc"> src="<%=WEBPATH%>/images/arrow_up.png"</html:if><html:else> src="<%=WEBPATH%>/images/arrow_down.png"</html:else> /> </html:if></td>
		<td align="left" <html:if test="asc"> onclick="javascript:imgOnclick('executeType',false);"</html:if><html:else> onclick="javascript:imgOnclick('executeType',true);" </html:else>><html:text name="workflowStep.executeType" /><html:if test="orderBy=='executeType'">&nbsp;<img  class="sort-arrow" <html:if test="asc"> src="<%=WEBPATH%>/images/arrow_up.png"</html:if><html:else> src="<%=WEBPATH%>/images/arrow_down.png"</html:else> /> </html:if></td>
		<td align="left" <html:if test="asc"> onclick="javascript:imgOnclick('remindType',false);"</html:if><html:else> onclick="javascript:imgOnclick('remindType',true);" </html:else>><html:text name="workflowStep.remindType" /><html:if test="orderBy=='remindType'">&nbsp;<img  class="sort-arrow" <html:if test="asc"> src="<%=WEBPATH%>/images/arrow_up.png"</html:if><html:else> src="<%=WEBPATH%>/images/arrow_down.png"</html:else> /> </html:if></td>
		<td align="left" <html:if test="asc"> onclick="javascript:imgOnclick('remindTime',false);"</html:if><html:else> onclick="javascript:imgOnclick('remindTime',true);" </html:else>><html:text name="workflowStep.remindTime" /><html:if test="orderBy=='remindTime'">&nbsp;<img  class="sort-arrow" <html:if test="asc"> src="<%=WEBPATH%>/images/arrow_up.png"</html:if><html:else> src="<%=WEBPATH%>/images/arrow_down.png"</html:else> /> </html:if></td>
		<td align="left" <html:if test="asc"> onclick="javascript:imgOnclick('lastDate',false);"</html:if><html:else> onclick="javascript:imgOnclick('lastDate',true);" </html:else>><html:text name="workflowStep.lastDate" /><html:if test="orderBy=='lastDate'">&nbsp;<img  class="sort-arrow" <html:if test="asc"> src="<%=WEBPATH%>/images/arrow_up.png"</html:if><html:else> src="<%=WEBPATH%>/images/arrow_down.png"</html:else> /> </html:if></td>
		<td align="left" <html:if test="asc"> onclick="javascript:imgOnclick('workflowTemplate',false);"</html:if><html:else> onclick="javascript:imgOnclick('workflowTemplate',true);" </html:else>><html:text name="workflowStep.workflowTemplate" /><html:if test="orderBy=='workflowTemplate'">&nbsp;<img  class="sort-arrow" <html:if test="asc"> src="<%=WEBPATH%>/images/arrow_up.png"</html:if><html:else> src="<%=WEBPATH%>/images/arrow_down.png"</html:else> /> </html:if></td>
		<td align="left" <html:if test="asc"> onclick="javascript:imgOnclick('preWorkflowTransitions',false);"</html:if><html:else> onclick="javascript:imgOnclick('preWorkflowTransitions',true);" </html:else>><html:text name="workflowStep.preWorkflowTransitions" /><html:if test="orderBy=='preWorkflowTransitions'">&nbsp;<img  class="sort-arrow" <html:if test="asc"> src="<%=WEBPATH%>/images/arrow_up.png"</html:if><html:else> src="<%=WEBPATH%>/images/arrow_down.png"</html:else> /> </html:if></td>
		<td align="left" <html:if test="asc"> onclick="javascript:imgOnclick('nextWorkflowTransitions',false);"</html:if><html:else> onclick="javascript:imgOnclick('nextWorkflowTransitions',true);" </html:else>><html:text name="workflowStep.nextWorkflowTransitions" /><html:if test="orderBy=='nextWorkflowTransitions'">&nbsp;<img  class="sort-arrow" <html:if test="asc"> src="<%=WEBPATH%>/images/arrow_up.png"</html:if><html:else> src="<%=WEBPATH%>/images/arrow_down.png"</html:else> /> </html:if></td>

		</tr> 
		</thead>
	<html:if test="pages.result==null">
		<tbody>
			<tr>
				<td colspan="18"><html:text name="global.page.emptyMsg" /></td>
			</tr>
		</tbody>
		<script type="text/javascript">
			jQuery("#delete").hide();
			jQuery("#edit").hide();
			jQuery("#view").hide(); 
		</script>
	</html:if>
	<html:else>
		<html:iterator id="users" value="pages.result"
			status="index">
			<tbody>
				<tr <html:if test="#index.odd">class="row_odd"</html:if>
					<html:else>class="row_even"</html:else>>
					<td align="left"><input type="checkbox" id="selectCheck" name="selectCheck"
						value="<html:property value="id"/>"></input></td>
										<td align="left"><html:property value="stepName" /></td>
					<td align="left"><html:property value="description" /></td>
					<td align="left"><html:text name="global.format.int"><html:param value="index" /></html:text></td>
					<td align="left"><html:text name="global.format.int"><html:param value="type" /></html:text></td>
					<td align="left"><html:property value="initFunction" /></td>
					<td align="left"><html:property value="runFunction" /></td>
					<td align="left"><html:property value="saveFunction" /></td>
					<td align="left"><html:property value="transitFunction" /></td>
					<td align="left"><html:property value="isCanEnd" /></td>
					<td align="left"><html:property value="executor" /></td>
					<td align="left"><html:property value="executeType" /></td>
					<td align="left"><html:property value="remindType" /></td>
					<td align="left"><html:text name="global.format.date"><html:param value="remindTime" /></html:text></td>
					<td align="left"><html:text name="global.format.int"><html:param value="lastDate" /></html:text></td>
					<td align="left"><html:property value="workflowTemplate" /></td>
					<td align="left"><html:property value="preWorkflowTransitions" /></td>
					<td align="left"><html:property value="nextWorkflowTransitions" /></td>

				</tr>
			</tbody>
		</html:iterator> 
		<tfoot>
		<tr>
			<td colspan="18" align="right" valign="middle">
			<script type="text/javascript"> 
				messages=new Array();
				messages[0]="<html:text name="global.page.first" />";
				messages[1]="<html:text name="global.page.prev" />";
				messages[2]="<html:text name="global.page.next" />";
				messages[3]="<html:text name="global.page.last" />";
				messages[4]="<html:text name="global.page.page" />";
				messages[5]="<html:text name="global.page.everyPage" />";
				messages[6]="<html:text name="global.page.total" />";
				messages[7]="<html:text name="global.page.record" />";
				messages[8]="<html:text name="global.page.primo" />";
				writePage(messages,"<%=WEBPATH%>","<html:property value="page"/>","<html:property value="pages.totalPages"/>","<html:property value="pageSize"/>");
			</script>
			</td>
		</tr></tfoot>
	</html:else>
</table>
</form>
</body>
</html>